/**************************************************************
// 特征模型仿真例1：参数辨识
simucpp版本：2.1.13
**************************************************************/
#include <cmath>
#include "env.hpp"
#include "tracelog.h"

Plant::Plant() {
    SetLogLevel(LOG_FATAL);
    in1 = new simucpp::UConstant(&sim1);
    tf1 = new simucpp::TransferFcn(&sim1, std::vector<double>{3, 4}, std::vector<double>{1, 5, 10, 6, 4});
    out1 = new simucpp::UOutput(&sim1);
    out1->Set_EnableStore(false);
    sim1.connectU(in1, tf1, 0);
    sim1.connectU(tf1, 0, out1);
    sim1.Initialize();
}
void Plant::Set_Input(double u) {
    in1->Set_OutValue(u);
}
void Plant::Simulate(double step) {
    for (uint32_t i = 0; i < step; i++)
        sim1.Simulate_OneStep();    
}
double Plant::Get_Output() {
    return out1->Get_OutValue();
}
